
import Vue from 'vue';
const whiteList = ['pages/login/login', 'pages/err/err'] // 在免登录白名单，直接进入

// 定义一个混入对象
import { mapMutations, mapState } from 'vuex';

Vue.mixin({
    data() {
        return {
        }
    },
    mounted() {
        var t = this
        if (t.route) {
            // router 路由
            if (whiteList.includes(t.route)) {
                uni.reLaunch({
                    url: t.route
                })
            } else {
                let token = t.$cfg.token() || '';
                if (t.f.isnull(token) == '') {
                    // #ifdef H5
                    uni.reLaunch({
                        url: '/pages/login/login'
                    })
                    // #endif	
                    // #ifdef MP-WEIXIN
                    uni.reLaunch({
                        url: '/pages/AuthorizedLogin/AuthorizedLogin'
                    })
                    // #endif	
                    // #ifdef APP-PLUS
                    uni.reLaunch({
                        url: '/pages/login/login'
                    })
                    // #endif	
                }
            }

        }
    },
    computed: {

    },
    methods: {
        ...mapMutations(['setsign', 'setsycp', 'setshopinfo']),
        $z(a, b) {
            var t = this
            if (b) {
                return t.$t(`${t.pagepath}.${a}`, b)
            } else {
                return t.$t(`${t.pagepath}.${a}`)
            }
        }
    }
})